package com.gjintel.auction.business.controller;/** * Created by Administrator on 2017/11/15 0015. */import com.gjintel.auction.business.model.AuctionCompareBid;import com.gjintel.auction.business.model.AuctionInfo;import com.gjintel.auction.business.model.RegAudit;import com.gjintel.auction.business.service.IAuctionCompareBidService;import com.gjintel.auction.business.service.IAuctionService;import com.gjintel.auction.business.service.IEntryService;import com.gjintel.auction.business.service.IRegAuditService;import com.gjintel.business.proj.controller.ProjectController;import com.gjintel.business.proj.model.ProjectPause;import com.gjintel.business.proj.service.IProjectBidService;import com.gjintel.business.proj.service.IProjectPauseService;import com.gjintel.business.proj.service.impl.NotifyServiceImpl;import com.gjintel.business.webcontent.model.WebContent;import com.gjintel.business.webcontent.service.IWebContentService;import com.gjintel.framework.common.service.IDepositExecuteService;import com.gjintel.framework.common.service.IDepositService;import com.gjintel.framework.constant.ActivitiMap;import com.gjintel.framework.constant.Constant;import com.gjintel.framework.constant.ProjectStatus;import com.gjintel.framework.constant.ProjectStatusAuction;import com.gjintel.framework.dataset.model.DataSet;import com.gjintel.framework.dataset.service.IDataSetService;import com.gjintel.framework.dict.model.Dictionary;import com.gjintel.framework.holidayset.service.IHolidaySetService;import com.gjintel.framework.log.model.LogInfo;import com.gjintel.framework.log.util.LogUtil;import com.gjintel.framework.projecttype.model.ProjectType;import com.gjintel.framework.projecttype.service.IProjectTypeService;import com.gjintel.framework.register.model.RegisterUser;import com.gjintel.framework.register.service.IRegisterUserService;import com.gjintel.framework.res.model.Resources;import com.gjintel.framework.role.model.ProjectOperation;import com.gjintel.framework.role.model.Role;import com.gjintel.framework.role.service.IRoleService;import com.gjintel.framework.user.model.User;import com.gjintel.framework.user.model.UserRole;import com.gjintel.framework.user.service.IUserService;import com.gjintel.framework.util.CommUtil;import com.gjintel.framework.util.DictUtil;import com.gjintel.framework.util.FileResUtil;import com.gjintel.sdk.base.dao.Page;import com.gjintel.sdk.base.dao.Sort;import com.gjintel.sdk.util.DateUtils;import com.gjintel.sdk.util.StringUtil;import com.gjintel.sdk.util.WordHandler;import com.gjintel.workflow.trade.dto.ProcessInstanceAndHistoryDto;import com.gjintel.workflow.trade.service.IWorkflowProcessInstanceService;import net.sf.json.JSONArray;import net.sf.json.JSONObject;import org.activiti.engine.RuntimeService;import org.activiti.engine.TaskService;import org.activiti.engine.task.Comment;import org.activiti.engine.task.Task;import org.apache.log4j.Logger;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.stereotype.Controller;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.ResponseBody;import org.springframework.web.multipart.MultipartFile;import org.springframework.web.multipart.MultipartHttpServletRequest;import org.springframework.web.servlet.ModelAndView;import javax.annotation.Resource;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import javax.servlet.http.HttpSession;import java.io.File;import java.io.IOException;import java.io.PrintWriter;import java.text.SimpleDateFormat;import java.util.*;import static com.gjintel.framework.util.Word2Pdf.word2Pdf;/** * 采购项目Controller * * @author xuyefei */@RequestMapping("/auction/business")@Controllerpublic class AuctionController {    @SuppressWarnings("unused")    private static final Logger LOG = Logger.getLogger(ProjectController.class);    /**     * 产权流程     */    private static final String PROCESS_AUCTION_KEY = "auctionProcess";    /**     * 编制审核通过7     */    private static final String COMPILEAUDITPASS = "1";    /**     * 编制审核不通过25     */    private static final String COMPILEAUDITNPASS = "0";    private static final String COMPILEAUDITCANCER = "2";    private static final String RESTORE_BUTTON = "4100";    private static final String REVOKE_BUTTON = "4200";    private static final String RESTORE_BUTTON_DEAL = "3900";    private static final String REVOKE_BUTTON_DEAL = "4000";    private static final String RESTORE_BUTTON_DEAL_z = "6300";    private static final String FLOW_BUTTON_DEAL_z = "6400";    private static final String RESTORE_BUTTON_z = "6500";    private static final String FLOW_BUTTON_z = "6600";    public static final String PAUSE_RESTORE_J = "1";//竞价公示暂停重启    public static final String PAUSE_REVOKE_J = "2";//竞价公示暂停撤销    public static final String PAUSE_RESTORE_Z = "3";//中标暂停重启    public static final String PAUSE_FLOW_J = "4";//竞价公示暂停流标    public static final String AUCTION_SIGN = "6700";   //项目报名    public static final String AUCTION_AUDIT = "6800";  //报名审核    public static final String AUCTION_SIGN_STATUS = "7600";    //报名状态    @Resource    private IAuctionService auctionService;    @Autowired    private IWorkflowProcessInstanceService workflowProcessInstanceService;    @Autowired    private IRoleService roleService;    @Autowired    private IProjectPauseService profectPauseService;    @Autowired    private IHolidaySetService holidaySetService;    @Autowired    private IProjectBidService projectBidService;    @Autowired    private IDataSetService dataSetService;    @Autowired    private IProjectTypeService projectTypeService;    @Autowired    private IDepositService depositService;    @Autowired    private NotifyServiceImpl notifyService;    @Autowired    private IRegisterUserService registerUserService;    @Autowired    private IDepositExecuteService depositExecuteService;    @Autowired    private IUserService userService;    @Autowired    private TaskService taskService;    @Autowired    private RuntimeService runtimeService;    @Autowired    private IWebContentService webContentService;    @Autowired    private IEntryService entryService;    @Autowired    private IAuctionCompareBidService auctionCompareBidService;    @Autowired    private IRegAuditService regAuditService;    /**     * 评审纪要     */    private Integer REVIEWSUMMARY_RES = 11;    /**     * 上传的合同资源文件     */    private Integer UPLOADCONTRACT_RES = 13;    /**     * 上传的中标通知书     */    private Integer BIDWINNERFILE_RES = 14;    /**     * @Author：shy     * @Description: 中心审核人列表     * @Date:上午 9:19   2017/11/17 0017     */    @RequestMapping("/centerAuditor/project")    public ModelAndView audit(HttpSession session) {        ModelAndView mv = new ModelAndView("/auction/center_auditor/project");        // 获取项目类型        List<ProjectType> projectTypeList = projectTypeService.findAll();        mv.addObject("projectTypeList", projectTypeList);        return mv;    }    /**     * 产权人项目列表     *     * @param session     * @return     */    @RequestMapping("/owner/project")    public ModelAndView index(HttpSession session) {        ModelAndView mv = new ModelAndView("/auction/owner/project");        User user = (User) session.getAttribute("loginUser");        // 获取项目类型        List<ProjectType> projectTypeList = projectTypeService.findAll();        mv.addObject("projectTypeList", projectTypeList);        // 判断是否为采购人，显示创建按钮        String roleIds = ActivitiMap.BUYER_ID;        boolean isShowCreateButton = roleService.isPrivilege(user.getId(), roleIds);        mv.addObject("isShowCreateButton", isShowCreateButton);        return mv;    }    /**     * 投标(竞拍)项目列表     *     * @param session     * @return     */    @RequestMapping("/bidder/shot")    public ModelAndView shot(HttpSession session) {        ModelAndView mv = new ModelAndView("/auction/bidder/project-shot");        // 获取项目类型        List<ProjectType> projectTypeList = projectTypeService.findAll();        User user = (User) session.getAttribute("loginUser");        mv.addObject("projectTypeList", projectTypeList);        mv.addObject("user", user);        mv.addObject("sessionId", session.getId());        return mv;    }    /**     * 业务管理员列表     *     * @param session     * @return     */    @RequestMapping("/bizmanager/projectBiz")    public ModelAndView projectBiz(HttpSession session) {        ModelAndView mv = new ModelAndView("/auction/bizmanager/project-biz");        // 获取项目类型        List<ProjectType> projectTypeList = projectTypeService.findAll();        mv.addObject("projectTypeList", projectTypeList);        return mv;    }    /**     * @param     * @return     * @description 财务管理员列表     */    @RequestMapping("/finance/financeList")    public ModelAndView finance(HttpSession session) {        List<Dictionary> depostFilter = DictUtil.dictChildren("depositFilter");        ModelAndView mv = new ModelAndView("/auction/finance/project");        mv.addObject("depostFilter", depostFilter);        // 获取项目类型        List<ProjectType> projectTypeList = projectTypeService.findAll();        mv.addObject("projectTypeList", projectTypeList);        return mv;    }    /**     * 系统管理员列表     *     * @param session     * @return     */    @RequestMapping("/bizmanager/projectSys")    public ModelAndView projectSys(HttpSession session) {        ModelAndView mv = new ModelAndView("/auction/sysmanager/project");        // 获取项目类型        List<ProjectType> projectTypeList = projectTypeService.findAll();        mv.addObject("projectTypeList", projectTypeList);        return mv;    }    /**     * @Author：shy     * @Description:获取列表数据     * @Date:上午 10:45   2017/11/17 0017     */    @RequestMapping("/list")    @ResponseBody    public JSONObject list(HttpSession session, AuctionInfo project, Page page, Sort sort, java.sql.Date startTime,                           java.sql.Date stopTime, java.sql.Date bidTime, java.sql.Date bidStopTime, String roleId) {        long sTime = System.currentTimeMillis(); // 获取开始时间        long eTime = 0;        User user = (User) session.getAttribute("loginUser");        // 结束时间处理，加一天        stopTime = StringUtil.addOneDayDate(stopTime, 1);        bidStopTime = StringUtil.addOneDayDate(bidStopTime, 1);        String _processIds = "";        String _filter = null;        //增加保证金筛选//		if(project.getExecutePromissFilter()!=null && project.getExecutePromissFilter().equals(Constant.UNPAY_EXECUTE_UNRETURN)){//		     //未交履约保证金未退//			project.setReturnDepositFlag(false);//			project.setStatusExecutePromiss(0);////		}else if (project.getExecutePromissFilter()!=null && project.getExecutePromissFilter().equals(Constant.PAY_EXECUTE_UNRETURN)){//			//已交履约保证金未退//			project.setReturnDepositFlag(false);//			project.setStatusExecutePromiss(1);//		}else if(project.getExecutePromissFilter()!=null && project.getExecutePromissFilter().equals(Constant.PAY_EXECUTE_RETURN)){//			//已交履约保证金已退//			project.setReturnDepositFlag(true);//			project.setStatusExecutePromiss(1);//		}else if(project.getExecutePromissFilter()!=null && project.getExecutePromissFilter().equals(Constant.ALL_DEPOSIT_RETURN)){//			//履约保证金已退(全退)//			project.setReturnDepositFlag(true);//			project.setStatusExecutePromiss(2);//		}        // 增加流程id的过滤：如果角色不是指定的“超级管理员，业务管理员、监督员、系统管理员“等 ，则取出processId过滤.        // TODO:数据量较大时要考虑性能问题（可考虑增加时间过滤)        if (!"bizmanager".equals(roleId)// 业务管理员页面                && !"administrator".equals(roleId)// 系统管理员页面                && !"finance".equals(roleId)//财务管理员页面                && !"superadmin".equals(roleId)                && !"bidder".equals(roleId)) { //竞拍人            List<ProcessInstanceAndHistoryDto> processInstanceList = workflowProcessInstanceService.findProcessInstanceAndHistoryList(PROCESS_AUCTION_KEY, user.getId(), roleId);            eTime = System.currentTimeMillis(); // 获取结束时间            for (ProcessInstanceAndHistoryDto dto : processInstanceList) {                _processIds += "'" + dto.getBusinessKey() + "',";            }            if (_processIds.length() > 0) {                _processIds = _processIds.substring(0, _processIds.length() - 1);            }            _filter = _processIds;        }        if (roleId.equals("bidder") == true) {            //如果是竞拍人页面只显示竞价公示之后的            this.auctionService.findAllByIds(_filter, project, page, sort, startTime, stopTime, bidTime, bidStopTime,                    null, null, ProjectStatusAuction.AUCTION_SHOW.toString(), ProjectStatusAuction.END.toString());        }        else {            this.auctionService.findAllByIds(_filter, project, page, sort, startTime, stopTime, bidTime, bidStopTime,                    null, null, null,null);        }        // 获取用户所以角色ids        String roleIds = "";        List<Role> roleList = roleService.findRolesByUserId(user.getId());        for (Role role : roleList) {            roleIds += "'" + role.getId() + "',";        }        if (roleIds.length() > 0) {            roleIds = roleIds.substring(0, roleIds.length() - 1);        }        List<AuctionInfo> pageList = page.getResult();        for (AuctionInfo pro : pageList) {            Dictionary dicProStatus = DictUtil.dict("proj_status", pro.getStatus() + "");            if (dicProStatus != null) {                pro.setStatusName(dicProStatus.getName());// 项目状态            } else {                pro.setStatusName("未知");// 项目状态            }            //判断项目报名状态，显示报名按钮            int signStatus = 1;            RegAudit a = regAuditService.findOneById(pro.getId(), user.getId());            if (a != null) {                signStatus = regAuditService.findOneById(pro.getId(), user.getId()).getStatus().intValue();            }            //用户是否禁止拍卖校验            Boolean isStop = false;            RegisterUser registerUser = this.auctionService.get(RegisterUser.class, user.getRegisterId());            if (registerUser == null) {                isStop = false;            }else {                Date dateNow = new Date();                Date forbidEndDate = registerUser.getForbidEndDate(); //禁投结束时间                //判断用户是否处于禁止拍卖                if (forbidEndDate != null && dateNow.getTime() < forbidEndDate.getTime()) {                    //禁止拍卖                    isStop = true;                }            }            //************************** BEGIN: 取出操作菜单列表，循环组合为html            StringBuffer _sbOpera = new StringBuffer("");            List<ProjectOperation> list = roleService.findOperationByRoleIdAndStatus(roleIds, pro.getStatus() + "", PROCESS_AUCTION_KEY);// 数据库中取            int opCount = 1;//操作菜单的数量            for (ProjectOperation op : list) {                if (op.getRoleId().equals(ActivitiMap.getProperty(roleId))) {                    //else                    if (op.getId().equals(Constant.BIDDING_PAUSE_BUTTON)) {//竞价公示暂停                        List<ProjectPause> pauselist = profectPauseService.getWorkingProjectPause(Constant.BIDDING_PAUSE, pro.getId());                        if (pauselist.size() < 1) {                            _sbOpera.append(op.getActionUrl().replace("row.id", pro.getId()) + (opCount % 3 == 0 ? "<br/>" : ""));                            opCount++;                        } else if (pauselist.get(0).getResult().equals("2") || pauselist.get(0).getResult().equals("3")) {                            _sbOpera.append(op.getActionUrl().replace("row.id", pro.getId()) + (opCount % 3 == 0 ? "<br/>" : ""));                            opCount++;                        }                    } else if (op.getId().equals(Constant.WIN_BIDDING_SHOW_PAUSE_BUTTON)) {//中标公示暂停                        List<ProjectPause> pauselist = profectPauseService.getWorkingProjectPause(Constant.WIN_BIDDING_SHOW_PAUSE, pro.getId());                        if (pauselist.size() < 1) {                            _sbOpera.append(op.getActionUrl().replace("row.id", pro.getId()) + (opCount % 3 == 0 ? "<br/>" : ""));                            opCount++;                        } else if (pauselist.get(0).getResult().equals("2") || pauselist.get(0).getResult().equals("3")) {                            _sbOpera.append(op.getActionUrl().replace("row.id", pro.getId()) + (opCount % 3 == 0 ? "<br/>" : ""));                            opCount++;                        }                    } else if (op.getId().equals(Constant.BIDDING_PAUSE_BUTTON_NB)) {//竞价公示暂停(不评标)                        List<ProjectPause> pauselist = profectPauseService.getWorkingProjectPause(Constant.BIDDING_PAUSE, pro.getId());                        if (pauselist.size() < 1) {                            _sbOpera.append(op.getActionUrl().replace("row.id", pro.getId()) + (opCount % 3 == 0 ? "<br/>" : ""));                            opCount++;                        } else if (pauselist.get(0).getResult().equals("2") || pauselist.get(0).getResult().equals("3")) {                            _sbOpera.append(op.getActionUrl().replace("row.id", pro.getId()) + (opCount % 3 == 0 ? "<br/>" : ""));                            opCount++;                        }                    } else if (op.getId().equals(Constant.WIN_BIDDING_SHOW_PAUSE_BUTTON_NB)) {//中标公示暂停(不评标)                        List<ProjectPause> pauselist = profectPauseService.getWorkingProjectPause(Constant.WIN_BIDDING_SHOW_PAUSE, pro.getId());                        if (pauselist.size() < 1) {                            _sbOpera.append(op.getActionUrl().replace("row.id", pro.getId()) + (opCount % 3 == 0 ? "<br/>" : ""));                            opCount++;                        } else if (pauselist.get(0).getResult().equals("2") || pauselist.get(0).getResult().equals("3")) {                            _sbOpera.append(op.getActionUrl().replace("row.id", pro.getId()) + (opCount % 3 == 0 ? "<br/>" : ""));                            opCount++;                        }                    } else if (op.getId().equals(RESTORE_BUTTON_DEAL)) {//业务管理员重启审核按钮                        if (pro.getPauseFlagJ()!=null && pro.getPauseFlagJ().equals(PAUSE_RESTORE_J)) {                            _sbOpera.append(op.getActionUrl().replace("row.id", pro.getId()) + (opCount % 3 == 0 ? "<br/>" : ""));                            opCount++;                        }                    } else if (op.getId().equals(REVOKE_BUTTON_DEAL)) {//业务管理员撤销审核按钮                        if (pro.getPauseFlagJ()!=null && pro.getPauseFlagJ().equals(PAUSE_REVOKE_J)) {                            _sbOpera.append(op.getActionUrl().replace("row.id", pro.getId()) + (opCount % 3 == 0 ? "<br/>" : ""));                            opCount++;                        }                    } else if (op.getId().equals(RESTORE_BUTTON)) {//中心审核人重启项目（业务管理员已审核）                        if (pro.getPauseFlagJ()!=null && pro.getPauseFlagJ().equals(PAUSE_RESTORE_J)) {                            _sbOpera.append(op.getActionUrl().replace("row.id", pro.getId()) + (opCount % 3 == 0 ? "<br/>" : ""));                            opCount++;                        }                    } else if (op.getId().equals(REVOKE_BUTTON)) {//中心审核人撤销项目（业务管理员已审核）                        if (pro.getPauseFlagJ()!=null && pro.getPauseFlagJ().equals(PAUSE_REVOKE_J)) {                            _sbOpera.append(op.getActionUrl().replace("row.id", pro.getId()) + (opCount % 3 == 0 ? "<br/>" : ""));                            opCount++;                        }                    } else if (op.getOperaName().equals("竞拍")) {                        _sbOpera.append(op.getActionUrl().replace("row.code", pro.getCode() == null ? "" : pro.getCode()) + (opCount % 3 == 0 ? "<br/>" : ""));                        opCount++;                    } else if (op.getOperaName().equals("查看中标通知书")) {                        //只有中标人或产权人才能显示 查看中标通知书                        if (user.getId().equals(pro.getWinnerId()) || user.getId().equals(pro.getCreateId())) {                            _sbOpera.append(op.getActionUrl().replace("row.id", pro.getId()) + (opCount % 3 == 0 ? "<br/>" : ""));                            opCount++;                        }                    } else if (op.getOperaName().equals("上传合同")) {                        //只有中标人或产权人才能显示 上传合同                        if (user.getId().equals(pro.getWinnerId()) || user.getId().equals(pro.getCreateId())) {                            _sbOpera.append(op.getActionUrl().replace("row.id", pro.getId()) + (opCount % 3 == 0 ? "<br/>" : ""));                            opCount++;                        }                    } else if (op.getOperaName().equals("打印合同")) {                        //只有中标人或产权人才能显示 打印合同                        if (user.getId().equals(pro.getWinnerId()) || user.getId().equals(pro.getCreateId())) {                            _sbOpera.append(op.getActionUrl().replace("row.id", pro.getId()) + (opCount % 3 == 0 ? "<br/>" : ""));                            opCount++;                        }                    } else if (op.getId().equals(RESTORE_BUTTON_DEAL_z)) {//业务管理员重启审核按钮(中标公示)                        if (pro.getPauseFlagJ()!=null && pro.getPauseFlagJ().equals(PAUSE_RESTORE_Z)) {                            _sbOpera.append(op.getActionUrl().replace("row.id", pro.getId()) + (opCount % 3 == 0 ? "<br/>" : ""));                            opCount++;                        }                    } else if (op.getId().equals(FLOW_BUTTON_DEAL_z)) {//业务管理员重启审核按钮(中标公示)                        if (pro.getPauseFlagJ()!=null && pro.getPauseFlagJ().equals(PAUSE_FLOW_J)) {                            _sbOpera.append(op.getActionUrl().replace("row.id", pro.getId()) + (opCount % 3 == 0 ? "<br/>" : ""));                            opCount++;                        }                    } else if (op.getId().equals(RESTORE_BUTTON_z)) {//业务管理员重启审核按钮(中标公示)                        if (pro.getPauseFlagJ()!=null && pro.getPauseFlagJ().equals(PAUSE_RESTORE_Z)) {                            _sbOpera.append(op.getActionUrl().replace("row.id", pro.getId()) + (opCount % 3 == 0 ? "<br/>" : ""));                            opCount++;                        }                    } else if (op.getId().equals(FLOW_BUTTON_z)) {//业务管理员重启审核按钮(中标公示)                        if (pro.getPauseFlagJ()!=null && pro.getPauseFlagJ().equals(PAUSE_FLOW_J)) {                            _sbOpera.append(op.getActionUrl().replace("row.id", pro.getId()) + (opCount % 3 == 0 ? "<br/>" : ""));                            opCount++;                        }                    } else if (op.getId().equals(AUCTION_SIGN)) {  //项目报名按钮                        if (pro.getEntryAble() && signStatus == 1 && user.getFlag().intValue()!=2 && !isStop) {    //flag=2为封存状态，不允许报名,isStop禁止报名不显示报名按钮                            _sbOpera.append(op.getActionUrl().replace("row.id", pro.getId()) + (opCount % 3 == 0 ? "<br/>" : ""));                            opCount++;                        }                    } else if (op.getId().equals(AUCTION_AUDIT)) {  //项目报名审核按钮                        if (pro.getEntryAble()) {                            _sbOpera.append(op.getActionUrl().replace("row.id", pro.getId()) + (opCount % 3 == 0 ? "<br/>" : ""));                            opCount++;                        }                    }else if (op.getId().equals(AUCTION_SIGN_STATUS)) {  //项目报名状态按钮                        if (pro.getEntryAble() && user.getFlag().intValue()!=2 && !isStop) {                            _sbOpera.append(op.getActionUrl().replace("row.id", pro.getId()) + (opCount % 3 == 0 ? "<br/>" : ""));                            opCount++;                        }                    } else if(op.getOperaName().equals("退还履约保证金")){                        if(pro.getTrusteeship()&& pro.getFinishExecuteDesposit()!=1){                            _sbOpera.append(op.getActionUrl().replace("row.id", pro.getId()) + (opCount % 3 == 0 ? "<br/>" : ""));                            opCount++;                        }                    } else if((op.getOperaName().equals("退还保证金"))){                         if(!pro.getReturnDepositFlag()){                              _sbOpera.append(op.getActionUrl().replace("row.id", pro.getId()) + (opCount % 3 == 0 ? "<br/>" : ""));                              opCount++;                         }                    }else if((op.getOperaName().equals("查询履约保证金"))){                         if(pro.getTrusteeship()){                            _sbOpera.append(op.getActionUrl().replace("row.id", pro.getId()) + (opCount % 3 == 0 ? "<br/>" : ""));                            opCount++;                        }                    }                    else {                        _sbOpera.append(op.getActionUrl().replace("row.id", pro.getId()) + (opCount % 3 == 0 ? "<br/>" : ""));                        opCount++;                    }                }            } //************************** END: 取出操作菜单列表，循环组合为html            if ("bizmanager".equals(roleId)) {// 列表页面是业务管理员列表页面时                // 终止                UserRole ur = roleService.findUserRole(ActivitiMap.BIZMANAGER_ID, user.getId());                if (ur != null && pro.getStatus().intValue()!= Integer.valueOf(ProjectStatusAuction.TERMINAL.toString()).intValue() // 撤销                        // 不显示终止操作菜单                        && pro.getStatus().intValue() != Integer.valueOf(ProjectStatusAuction.END.toString()).intValue()// 结项                        // 不显示终止操作菜单                        && pro.getStatus().intValue()!= Integer.valueOf(ProjectStatusAuction.FLOW.toString()).intValue()){//流标                    // 不显示终止操作菜单                    _sbOpera.append(Constant.CANCLE_PROJECT.replace("row.id", pro.getId()));                }//                //添加 查看资料 操作(任何状态下)//                _sbOpera.append(Constant.VIEWFILE_OPERATION.replace("row.id", pro.getId()));            }//			// 系统管理员//			if ("administrator".equals(roleId)) {// 列表页面是系统管理员列表页面时//				UserRole adminUr = roleService.findUserRole(ActivitiMap.ADMINISTRATOR_ID, user.getId());//				if (adminUr != null && isCodeEdit(pro.getStatus())) {//					// 添加变更项目编号//					_sbOpera.append(Constant.EDITPROJECTCODE_OPERATION.replace("row.id", pro.getId()));//				}//			}            // 添加项目详情操作            _sbOpera.append(Constant.DETAILS_OPERATION.replace("row.id", pro.getId()));            pro.setOperation(_sbOpera.toString());        }        System.err.println("++++++++++++++++++++++++ 耗时： " + (eTime - sTime));        return CommUtil.getPageJSONData(page, true);    }    /**     * @description 判断退还履约保证按钮出现状态是否在列举的状态中存在     * @author shy     */    private boolean excuteDepositButtionByProjectStatus(Integer status) {        List<Integer> list = new ArrayList<Integer>();        list.addAll(Arrays.asList(Integer.valueOf(ProjectStatus.WAIT_PROJ_OVER_SURE.toString()), // 结项                Integer.valueOf(ProjectStatus.PROJ_OVER.toString()), // 项目结束                Integer.valueOf(ProjectStatus.CANCEL.toString())));// 撤销        return list.contains(status);    }    /**     * 打开新增或修改页面     *     * @param projectId     * @return     */    @RequestMapping("/input")    public ModelAndView input(HttpSession session, String projectId, String show) {        User user = (User) session.getAttribute("loginUser");        DataSet dataset = dataSetService.get(DataSet.class, Constant.DATASET_ID);        int confirmDay = dataset.getProjectAuditTimeout();        int auctionPublicity = dataset.getAuctionPublicity();        int auctionTimeDay = confirmDay + auctionPublicity;        ModelAndView mv = new ModelAndView("/auction/business/project-input");        mv.addObject("user", user);        AuctionInfo project = null;        if (!StringUtil.isEmpty(projectId)) {            project = this.auctionService.get(AuctionInfo.class, projectId);            List<Resources> resList = FileResUtil.findResources(project.getId());            mv.addObject("resList", resList);            mv.addObject("project", project);        }         mv.addObject("dataset",dataset);         mv.addObject("auctionTimeDay",auctionTimeDay);        return mv;    }    /**     * @param session     * @param project     * @param budgetMenuData     * @return     * @throws IOException     * @description 项目保存     * @author shy     * @date 2017-11-20     */    @RequestMapping("/save")    @ResponseBody    public String save(HttpSession session, AuctionInfo project, String budgetMenuData, String bidStartDateStr, String bidStartTimeStr) throws IOException {        User user = (User) session.getAttribute("loginUser");        Date bidStartTime = null;        Date bidEndTime = null;        //设置审核时间        DataSet dataset = dataSetService.get(DataSet.class, Constant.DATASET_ID);        int auditDays = dataset.getProjectAuditTimeout();        String auditDate = DateUtils.computeWorkDayDateStr(holidaySetService, new Date(), auditDays);// 审核时间        project.setAuditTime(StringUtil.StringToDate(auditDate));//设置审核时间        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");        if (bidStartDateStr != null && !bidStartDateStr.isEmpty()) {            String bidStartStr = bidStartDateStr + " " + bidStartTimeStr + ":00:00";            bidStartTime = StringUtil.StringToDate(bidStartStr);        }        project.setAuctionStart(bidStartTime);        if (bidStartDateStr != null && !bidStartDateStr.isEmpty()) {            String bidStartStr = bidStartDateStr + " " + bidStartTimeStr + ":30:00";            bidEndTime = StringUtil.StringToDate(bidStartStr);        }        project.setAuctionEnd(bidEndTime);        project.setAuctionShowStart(new Date());//竞拍公告开始时间        project.setAuctionShowEnd(bidStartTime);//竞拍公告结束时间        // 项目保存        auctionService.saveProject(user, budgetMenuData, project, Integer.valueOf(ProjectStatusAuction.CREATE.toString()));        return Constant.SUCCESS;    }    /**     * 项目提交     *     * @return     */    @RequestMapping("/doSubmit")    @ResponseBody    public String doSubmit(HttpSession session, AuctionInfo project, String budgetMenuData, HttpServletRequest request, String bidStartDateStr,                           String bidStartTimeStr, String qualifyFromDateStr) {        User user = (User) session.getAttribute("loginUser");        Date bidStartTime = null;        Date bidEndTime = null;        //设置审核时间        DataSet dataset = dataSetService.get(DataSet.class, Constant.DATASET_ID);        int auditDays = dataset.getProjectAuditTimeout();        String auditDate = DateUtils.computeWorkDayDateStr(holidaySetService, new Date(), auditDays);// 审核时间        project.setAuditTime(StringUtil.StringToDate(auditDate));//设置审核时间        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");        if (bidStartDateStr != null && !bidStartDateStr.isEmpty()) {            String bidStartStr = bidStartDateStr + " " + bidStartTimeStr + ":00:00";            bidStartTime = StringUtil.StringToDate(bidStartStr);        }        project.setAuctionStart(bidStartTime);        if (bidStartDateStr != null && !bidStartDateStr.isEmpty()) {            String bidStartStr = bidStartDateStr + " " + bidStartTimeStr + ":30:00";            bidEndTime = StringUtil.StringToDate(bidStartStr);        }        project.setAuctionEnd(bidEndTime);        project.setAuctionShowStart(new Date());//竞拍公告开始时间        project.setAuctionShowEnd(bidStartTime);//竞拍公告结束时间        auctionService.saveProject(user, budgetMenuData, project, Integer.valueOf(ProjectStatusAuction.AUDIT.toString()));        // 生成竞价文件world        Resources res = new Resources();        generateWord(request, project, res);        //日志        LogUtil.addLog(new LogInfo("项目提交" + project.getAuctionName() + "项目状态,", user.getId(), user.getName(),                String.valueOf(LogUtil.LogType.UPDATE.ordinal()), project.getClass().getSimpleName(), project.getId()));        return Constant.SUCCESS;    }    /**     * @param request     * @param project     * @param bidStartDateStr     * @param bidStartTimeStr     * @param qualifyFromDateStr     * @param qualifyEndDateStr     * @param budgetMenuData     * @return     * @throws Exception     * @description 生成world文档预览     * @author wwang     * @date 2016年9月21日     */    @RequestMapping("/generateWord")    @ResponseBody    public String generateWord(HttpServletRequest request, AuctionInfo project, String bidStartDateStr,                               String bidStartTimeStr, String qualifyFromDateStr, String qualifyEndDateStr, String budgetMenuData)            throws Exception {        // 开拍时间处理        Date bidStartTime = null;        Date bidEndTime = null;        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");        if (bidStartDateStr != null && !bidStartDateStr.isEmpty()) {            String bidStartStr = bidStartDateStr + " " + bidStartTimeStr + ":00:00";            bidStartTime = StringUtil.StringToDate(bidStartStr);        }        project.setAuctionStart(bidStartTime);        if (bidStartDateStr != null && !bidStartDateStr.isEmpty()) {            String bidStartStr = bidStartDateStr + " " + bidStartTimeStr + ":30:00";            bidEndTime = StringUtil.StringToDate(bidStartStr);        }        project.setAuctionEnd(bidEndTime);        project.setAuctionShowStart(new Date());//竞拍公告开始时间        project.setAuctionShowEnd(bidStartTime);//竞拍公告结束时间        ProjectType catagory = this.auctionService.get(ProjectType.class, project.getCatagoryId());        if (catagory != null) {            project.setCatagoryName(this.auctionService.get(ProjectType.class, project.getCatagoryId()).getName());//项目类型        }        // 生成world        Resources res = new Resources();        generateWord(request, project, res);//		List<Resources> res = FileResUtil.findResources(project.getId());        return JSONArray.fromObject(res).toString();    }    /**     * @param request     * @param project     * @description 生成world方法     * @author wwang     * @date 2016-8-29     */    private void generateWord(HttpServletRequest request, AuctionInfo project, Resources res) {        // 数据处理        //project.setFundFromName(DictUtil.dict("fundFroms", project.getFundFrom()).getName());// 资金来源        String oldName = project.getAuctionName() + "-竞价文件.PDF";        // 判断使用world模板版本        String worldXmlPath = "rent.xml";// 模板名称        // 项目类型        if (Constant.PROJECTCATAGORY_RENT.equals(project.getCatagoryId())) {//租赁类            worldXmlPath = "rent.xml";        } else if (Constant.PROJECTCATAGORY_TRANSFER.equals(project.getCatagoryId())) {//产权类            worldXmlPath = "transfer.xml";        }        // 得到文件的相对路径        // 得到文件的相对路径        String relativePath = File.separator + "project";        String uploadPath = request.getSession().getServletContext().getRealPath("file_resource") + relativePath;        File filePath = new File(uploadPath);        // 判断文件夹是否存在，如果不存在给与创建出来        if (!filePath.exists()) {            filePath.mkdirs();        }        // 保存文档到res数据        if (!project.getId().isEmpty()) {            List<Resources> resList = FileResUtil.findResources(project.getId());            // 删除之前的生成的竞价文件            for (Resources resources : resList) {                if (resources.getFunctionFlog() == 1) {                    FileResUtil.deleteFile(resources.getId(), request);                }            }        }        String exeName = ".doc";        res.setExeName(exeName);        res.setFilePath(relativePath);        res.setFileSize(50L);        res.setOldName(oldName);        if (project.getId() != null) {            res.setBusinessId(project.getId());        }        res.setFunctionFlog(1);// 设置文件功能类型(竞价文件)        FileResUtil.addFileRes(res); // 保存文件记录        //价格分段拼接        String step = "";        if (project.getStepPrice1() != null) {            step = step + project.getStepPrice1() + "元，";        }        if (project.getStepPrice2() != null) {            step = step + project.getStepPrice2() + "元，";        }        if (project.getStepPrice3() != null) {            step = step + project.getStepPrice3() + "元，";        }        if (project.getStepPrice4() != null) {            step = step + project.getStepPrice4() + "元，";        }        if (project.getStepPrice5() != null) {            step = step + project.getStepPrice5() + "元，";        }        if (project.getStepPrice6() != null) {            step = step + project.getStepPrice6() + "元，";        }        if (project.getStepPrice7() != null) {            step = step + project.getStepPrice7() + "元，";        }        if (project.getStepPrice8() != null) {            step = step + project.getStepPrice8() + "元，";        }        if (step.length() > 0)        {            step = step.substring(0, step.length() - 1);        }        project.setStepString(step);        // 生成文档        // world保存的真实路径        String path = uploadPath + "/" + res.getId() + ".doc";        Map map = new HashMap();        // 时间        map.put("maxDate", DateUtils.dataToUpper(new Date()));        // 项目信息        map.put("project", project);        Integer auctionSleep = dataSetService.getDataSet().getAuctionSleep();        // 竞拍延迟秒        map.put("auctionSleep", auctionSleep);        WordHandler word = new WordHandler();        word.generateWord(path, map, worldXmlPath);// worldXmlPath        String pdfPath = uploadPath + "/" + res.getId() + ".pdf";        word2Pdf(path, pdfPath);        res.setExeName(".pdf");        res.setFilePath(relativePath);//改为转换后的PDF文件        FileResUtil.addFileRes(res); // 保存文件记录    }    /**     * 项目审核页面     *     * @param projectId     * @return     */    @RequestMapping("/centerAuditor/auditInput")    public ModelAndView auditInput(String projectId) {        ModelAndView mv = new ModelAndView("/auction/center_auditor/audit-input");        AuctionInfo project = this.auctionService.get(AuctionInfo.class, projectId);        mv.addObject("project", project);        return mv;    }    /**     * @return String     * @description 项目审核操作     */    @RequestMapping("/centerAuditor/approve")    @ResponseBody    public String approve(HttpSession session,HttpServletRequest request, AuctionInfo projectInfo, String compileAudit) {//		//当前时间已超过16:30,无法进行确认//		String nowStr = DateUtils.simpleDateFormat(new Date(), "yyyy-MM-dd");//		Date validateTime = DateUtils.simpleDateFormat(nowStr + " 16:30:00", "yyyy-MM-dd HH:mm:ss");//		if (new Date().getTime() >= validateTime.getTime()) {//			return "false";//		}        User user = (User) session.getAttribute("loginUser");        AuctionInfo pro = auctionService.get(AuctionInfo.class, projectInfo.getId());        String reasonTemp = "";        if (!compileAudit.equals(COMPILEAUDITCANCER) ) {            if (compileAudit.equals(COMPILEAUDITPASS)) {//通过                reasonTemp = projectInfo.getCancelReason() + "</td><th>审核结果</th><td>审核通过";                if(pro.getCode()==null){                     pro.setCode(auctionService.generateProjectCode(pro));                }                pro.setAuditId(user.getId());                pro.setAuditName(user.getName());                pro.setAuditTime(new Date());                pro.setAuctionShowStart(new Date());//竞拍公告开始时间                pro.setAuctionShowEnd(pro.getAuctionStart());//竞拍公告结束时间                //推送信息至银行（投标保证金）                boolean result = postBank(pro);                if (!result) {//投标保证金推送失败                    return "postbankfaill";                }                // 生成竞价文件world                Resources res = new Resources();                generateWord(request, pro, res);//生成竞价文件            } else if (compileAudit.equals(COMPILEAUDITNPASS)) {//不通过              //  pro.setCode(auctionService.generateProjectCode(pro));                pro.setAuditId(user.getId());                pro.setAuditName(user.getName());                pro.setAuditTime(new Date());                reasonTemp = projectInfo.getCancelReason() + "</td><th>审核结果</th><td>审核不通过";            }            //流程 任务完成            Task task = workflowProcessInstanceService.findTask(pro.getWorkflowId());            Map<String, Object> variables = new HashMap<String, Object>();            if(compileAudit.equals(COMPILEAUDITPASS)){                 variables.put("auditPass", true);//审核结果            }else if(compileAudit.equals(COMPILEAUDITNPASS)){                 variables.put("auditPass", false);//审核结果            }            Long time = pro.getAuctionStart().getTime();            time = time - 1 * 60 * 1000;//提前1分钟开始竞价流程            Date auctionPublishEndTime = new Date(time);            variables.put("auctionPublishEndTime", StringUtil.getISODate(auctionPublishEndTime));//开标时间            time = pro.getAuctionEnd().getTime();            time = time + 1 * 60 * 1000;//延迟1分钟结束竞价流程            Date auctionEndTime = new Date(time);//竞价结束时间            variables.put("auction_end_time", StringUtil.getISODate(auctionEndTime));//结束时间            variables.put("auditor", user.getId());              //设置 审核人            variables.put("applyUserId", projectInfo.getCreateId());         //设置初始人            variables.put("terminate", false);            // 添加批注            workflowProcessInstanceService.addComment(user.getLoginName(), task.getId(), pro.getWorkflowId(), reasonTemp);            workflowProcessInstanceService.complete(task.getId(), variables);        } else {//结束项目              pro.setAuditId(user.getId());              pro.setAuditName(user.getName());              pro.setAuditTime(new Date());            reasonTemp = projectInfo.getCancelReason() + "</td><th>审核结果</th><td>结束项目";            // 流程 任务完成            Task task = workflowProcessInstanceService.findTask(pro.getWorkflowId());            Map<String, Object> variables = new HashMap<String, Object>();            // variables.put("auditPass", compileAudit);//审核结果            //  variables.put("showTime", StringUtil.getISODate(pro.getAuctionStart()));//开标时间            // variables.put("auditor", user.getId());              //设置 审核人            //  variables.put("applyUserId", projectInfo.getCreateId());         //设置初始人            variables.put("terminate", true);//审核结果            // 添加批注            workflowProcessInstanceService.addComment(user.getLoginName(), task.getId(), pro.getWorkflowId(), reasonTemp);            workflowProcessInstanceService.complete(task.getId(), variables);        }        this.auctionService.saveOrUpdate(pro);        return Constant.SAVE_SUCCESS;    }    /**     * 推送信息至银行操作（投标保证金）     *     * @return     */    public boolean postBank(AuctionInfo pi) {        // 第一次        int n = 1;        try {            int _ret = depositService.regToBank(pi.getId());            if (_ret == 1) {                System.out.print("注册成功!");                return true;            } else {                System.out.print("注册 不成功");                n++;            }        } catch (IOException e) {            System.out.print("注册 不成功，出现异常");            e.printStackTrace();            n++;        }        // 第二次        try {            int _ret = depositService.regToBank(pi.getId());            if (_ret == 1) {                System.out.print("第二次注册成功!");                return true;            } else {                System.out.print("第二次注册 不成功");                n++;            }        } catch (IOException e) {            System.out.print("第二次注册 不成功，出现异常");            e.printStackTrace();            n++;        }        // 第三次        try {            int _ret = depositService.regToBank(pi.getId());            if (_ret == 1) {                System.out.print("第三次注册成功!");                return true;            } else {                System.out.print("第三次注册 不成功");                n++;            }        } catch (IOException e) {            System.out.print("第三次注册 不成功，出现异常");            e.printStackTrace();            n++;        }        if (n >= 3) {            // 发布三次未注册上的消息给系统管理 员            this.notifyService.savePostBankFallNotify(pi);            return false;        }        return false;    }    /**     * 获取交易方式     *     * @return     */    @RequestMapping("/getTradeType")    @ResponseBody    public JSONArray getTradeType() {        List<Dictionary> natures = DictUtil.dictChildren("tradeType");        return JSONArray.fromObject(natures);    }    /**     * 上传附件     *     * @param request     * @param response     * @param functionFlag     * @throws IOException     */    @RequestMapping("/upload")    public void upload(HttpServletRequest request, HttpServletResponse response, Integer functionFlag)            throws IOException {        PrintWriter out = response.getWriter();        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;        // 取得request中的文件,获取一个list集合        MultipartFile file = multipartRequest.getFile("Filedata");        // 得到文件的相对路径        String relativePath = File.separator + "project";        String uploadPath = request.getSession().getServletContext().getRealPath("file_resource") + relativePath;        File filePath = new File(uploadPath);        // 判断文件夹是否存在，如果不存在给与创建出来        if (!filePath.exists()) {            filePath.mkdirs();        }        String fileName = file.getOriginalFilename();        Resources res = new Resources();        String exeName = fileName.substring(fileName.lastIndexOf("."), fileName.length());        res.setExeName(exeName);        res.setFilePath(relativePath);        res.setFileSize(file.getSize());        res.setOldName(fileName);        res.setFunctionFlog(functionFlag);// 设置文件功能类型(交易申报表。。。。)        FileResUtil.addFileRes(res); // 保存文件记录        File newFile = new File(uploadPath, res.getId() + res.getExeName());        file.transferTo(newFile);        out.write(res.getId());        out.flush();        out.close();    }    /**     * @description 查看项目详情     * @author xuyefei     * @date 2016-4-13 下午07:50:45     * @return ModelAndView     */    /**     * @param session     * @param projectId     * @param type     * @return     */    @RequestMapping("/getProjectDetail")    public ModelAndView getProjectDetail(HttpSession session, String projectId, String type, String roleId) {        User user = (User) session.getAttribute("loginUser");        RegisterUser registerUser = this.auctionService.get(RegisterUser.class, user.getRegisterId());        AuctionInfo project = auctionService.get(AuctionInfo.class, projectId);        ModelAndView mv = new ModelAndView();        mv.setViewName("/auction/public/project-detail");        mv.addObject("projectId", projectId);        mv.addObject("roleId", roleId);        // 1、=============数据信息查询========        //十条竞拍信息        if (project.getStatus().intValue() >= 50 ) {  //竞拍结束可查看竞拍信息 && regAuditService.findOneByAuctionId(projectId).size()>0            mv.addObject("status", true);        }else {            mv.addObject("status", false);        }        List<AuctionCompareBid> bidInfo = this.auctionCompareBidService.findTopTenByAuctionId(projectId);        mv.addObject("bidInfo", bidInfo);        //竞拍人自己出价信息        List<AuctionCompareBid> selfBidInfo = this.auctionCompareBidService.findAllByAuctionIdAndBiddrId(projectId, user.getId());        mv.addObject("selfBidInfo", selfBidInfo);        //竞拍人报名状态        RegAudit regAudit = regAuditService.findOneById(projectId, user.getId());        if (regAudit != null) {            if (regAudit.getStatus().intValue() == 0) {                mv.addObject("selfBidInfoStatus", "申请中");            } else if (regAudit.getStatus().intValue() == 1) {                mv.addObject("selfBidInfoStatus", "未通过");            } else if (regAudit.getStatus().intValue() == 2) {                mv.addObject("selfBidInfoStatus", "已通过");            }        } else {            mv.addObject("selfBidInfoStatus", "未报名");        }        // 数据处理        project.setStatusName(DictUtil.dict("proj_status", project.getStatus() + "").getName());// 项目状态    //    if (project.getFundFrom() != null && !StringUtil.isEmpty(project.getFundFrom())) {//            project.setFundFromName(DictUtil.dict("fundFroms", project.getFundFrom()).getName());// 资金来源   //     }        mv.addObject("project", project);        // 1.2、1 查询项目审核信息        List<Comment> commentList = workflowProcessInstanceService.findCommentByTaskId(project.getWorkflowId());        mv.addObject("commentList", commentList);        // 1.2、2 查询审核信息--产权人确认竞拍结果        List<Comment> commentOwnFailList = workflowProcessInstanceService.findCommentByTaskId(project.getWorkflowId(),"confirmReason");        mv.addObject("commentOwnFailList", commentOwnFailList);        // 1.2、3 查询审核信息--中心审核人审核结果        List<Comment> commentFailList = workflowProcessInstanceService.findCommentByTaskId(project.getWorkflowId(),"centerReslutAuditReason");        mv.addObject("commentFailList", commentFailList);        // 1.4、附件资源        List<Resources> resList = FileResUtil.findResources(projectId);        if (auctionService.get(AuctionInfo.class, projectId).getCatagoryId().equals("540d5cef8b0004f000000056a29c3a02")) {    //转让、租赁            mv.addObject("isAttorn", true);            mv.addObject("isLease", false);        } else {            mv.addObject("isAttorn", false);            mv.addObject("isLease", true);        }        mv.addObject("resList", resList);        // 1.6、合同审核        List<Comment> contractAuditList = workflowProcessInstanceService.findCommentByTaskId(project.getWorkflowId(),                "contract_audit");        mv.addObject("contractAuditList", contractAuditList);        // 1.7、竞价公示暂停信息        List<ProjectPause> shotPauseList = this.profectPauseService.getPrjectPause(project.getId(), "0");        mv.addObject("shotPauseList", shotPauseList);        // 1.8、中标公示暂停信息        List<ProjectPause> bidPauseList = this.profectPauseService.getPrjectPause(project.getId(), "1");        mv.addObject("bidPauseList", bidPauseList);        // 1.9、质疑投诉答复处理结果        List<WebContent> webContentList = this.webContentService.findListByProjectId(project.getId());        mv.addObject("webContentList", webContentList);        // 2、=============================数据信息权限控制=====================================        // 2.1、是否显示审核信息(中心审核人、采购人、系统管理员)        String roleIds = ActivitiMap.BUYER_ID + "," + ActivitiMap.BIZMANAGER_ID + "," + ActivitiMap.ADMINISTRATOR_ID + "," + ActivitiMap.SUPERADMIN_ID                + "," + ActivitiMap.FINANCE_ID + "," + ActivitiMap.CENTERAUDITOR_ID;        boolean isShowAudit = roleService.isPrivilege(user.getId(), roleIds);        if (isShowAudit) {            isShowAudit = project.getAuditId() == null ? false : true;// 无审核人id，不显示        }        mv.addObject("isShowAudit", isShowAudit);        // 2.4、是否显示附件资源信息        roleIds = ActivitiMap.BUYER_ID + "," + ActivitiMap.BIZMANAGER_ID + "," + ActivitiMap.ADMINISTRATOR_ID + "," + ActivitiMap.SUPERADMIN_ID                + "," + ActivitiMap.FINANCE_ID + "," + ActivitiMap.CENTERAUDITOR_ID;        boolean isShowAnnexes = roleService.isPrivilege(user.getId(), roleIds);        // 无附件信息，不显示        if (isShowAnnexes) {            isShowAnnexes = isHasAnnexesInfo(resList);        }        mv.addObject("isShowAnnexes", isShowAnnexes);        // 2.12、公示信息(待开标后可见)        boolean isShowPublicityInfo = true;        mv.addObject("isShowPublicityInfo", isShowPublicityInfo);        // 2.6、投标信息(项目负责人不可见非本人负责项目的投标信息，采购人在项目详情中仅可见中标人信息，非中标人投标信息不可见；投标人仅可见自己的投标信息，        // 其他投标人信息不可见，项目分配人、系统管理员不可见投标信息，系统仅审核人和业务管理员可以看见所有项目的投标信息)        boolean isShowBidList = true;//投标信息(投标信息列表+中标人信息)        boolean isShowBidGrid = true;//投标信息列表        boolean isShoter = false;//是否为投标人        if (registerUser != null) {// 投标人            isShowBidList = getBidderProjectStatusList(project.getStatus());            isShoter = true;        } else if ("buyer".equals(roleId)) {//采购人（在中标/流标确认之后看不见投标信息）            isShowBidList = getBuyerProjectStatusList(project.getStatus());        } else {            isShowBidList = getOtherProjectStatusList(project.getStatus());        }        mv.addObject("isShowBidList", isShowBidList);        mv.addObject("isShowBidGrid", isShowBidGrid);        mv.addObject("isShoter", isShoter);        // 2.8、合同审核信息(采购人、系统管理员、监督员、受理分配人、中心审核人、中标人)        roleIds = ActivitiMap.BIDDER_ID + "," + ActivitiMap.BUYER_ID + "," + ActivitiMap.BIZMANAGER_ID + "," + ActivitiMap.ADMINISTRATOR_ID + "," + ActivitiMap.SUPERADMIN_ID                + "," + ActivitiMap.FINANCE_ID + "," + ActivitiMap.CENTERAUDITOR_ID;        boolean isShowContractAudit = roleService.isPrivilege(user.getId(), roleIds);        if (registerUser != null) {            if (registerUser.getId().equals(project.getWinnerId())) {// 为中标人                isShowContractAudit = true;            }        }        if (isShowContractAudit) {            isShowContractAudit = isShowContractAudit(resList);// 判读是否有合同审核信息        }        mv.addObject("isShowContractAudit", isShowContractAudit);        // 2.9、竞价公示暂停        roleIds = ActivitiMap.BUYER_ID + "," + ActivitiMap.BIZMANAGER_ID + "," + ActivitiMap.ADMINISTRATOR_ID + "," + ActivitiMap.SUPERADMIN_ID                + "," + ActivitiMap.FINANCE_ID + "," + ActivitiMap.CENTERAUDITOR_ID;        boolean isShowShotPause = roleService.isPrivilege(user.getId(), roleIds);        if (registerUser != null) {// 投标人            isShowShotPause = isShowByProjectStatus(project.getStatus());        }        if (shotPauseList == null || shotPauseList.size() <= 0) {            isShowShotPause = false;        }        mv.addObject("isShowShotPause", isShowShotPause);        // 2.10、中标公示暂停(审核人、采购人、系统管理员、监督人、受理分配人、项目负责人、业务管理员、中心审核人)        roleIds = ActivitiMap.BUYER_ID + "," + ActivitiMap.BIZMANAGER_ID + "," + ActivitiMap.ADMINISTRATOR_ID + "," + ActivitiMap.SUPERADMIN_ID                + "," + ActivitiMap.FINANCE_ID + "," + ActivitiMap.CENTERAUDITOR_ID;        boolean isShowBidPause = roleService.isPrivilege(user.getId(), roleIds);        if (registerUser != null) {// 投标人            isShowBidPause = isShowByProjectStatus(project.getStatus());        }        if (bidPauseList == null || bidPauseList.size() <= 0) {            isShowBidPause = false;        }        mv.addObject("isShowBidPause", isShowBidPause);        // 2.11、质疑投诉答复处理结果        roleIds = ActivitiMap.BUYER_ID + "," + ActivitiMap.BIZMANAGER_ID + "," + ActivitiMap.ADMINISTRATOR_ID + "," + ActivitiMap.SUPERADMIN_ID                + "," + ActivitiMap.FINANCE_ID + "," + ActivitiMap.CENTERAUDITOR_ID;        boolean isShowOppugn = roleService.isPrivilege(user.getId(), roleIds);        if (registerUser != null) {// 投标人            isShowOppugn = isShowByProjectStatus(project.getStatus());        }        if (isShowOppugn) {// 判断是否有信息            isShowOppugn = webContentList == null || webContentList.size() <= 0 ? false : true;        }        mv.addObject("isShowOppugn", isShowOppugn);        // 投标人中标确认后能看到        boolean isBidder = true;        if (registerUser != null) {// 投标人            isBidder = isShowByProjectStatus(project.getStatus());        }        mv.addObject("isBidder", isBidder);        //是否为中标人        boolean isHitBidder = false;        if (registerUser != null) {            if (project.getWinnerId() != null && registerUser.getId().equals(project.getWinnerId())) {                isHitBidder = true;            }        }        mv.addObject("isHitBidder", isHitBidder);        boolean isRevoke =false;//显示撤销信息        if(project.getStatus().intValue() ==900 ) {            isRevoke=true;            mv.addObject("isRevoke", isRevoke);        }        //查询银行接口，履约保证金缴纳信息//        if (project.getExecuteBankAuthCode() != null) {//            List<Bank> bidBondInfoList = depositExecuteService.getDepositList(project.getId());//            mv.addObject("bidBondInfoList", bidBondInfoList);////            DepositReturn bidBondInfo = groupBidBondInfo(bidBondInfoList, bidInfo);//组装履约保证金信息对象//            mv.addObject("bidBondInfo", bidBondInfo);//        }////        //获取中标公示暂停 变更中标结果信息//        List<BidderChange> bidderChangeList = getEditHitResult(project.getId());//        mv.addObject("bidderChangeList", bidderChangeList);        return mv;    }    /**     * @param resList     * @return     * @description 判断是否有附件信息     * @author wwang     * @date 2016-9-2     */    private boolean isHasAnnexesInfo(List<Resources> resList) {        // 判断是否有附件信息        for (Resources res : resList) {            if (REVIEWSUMMARY_RES == res.getFunctionFlog()) {                return true;            }        }        return false;    }    /**     * @description 投标人是否能查看项目的信息     * @author wwang     * @date 2016年9月18日     */    private boolean isShowByProjectStatus(Integer status) {        List<Integer> list = new ArrayList<Integer>();        list.addAll(Arrays.asList(                Integer.valueOf(ProjectStatusAuction.HIT_SHOW.toString()),                Integer.valueOf(ProjectStatusAuction.SHOW_CONTRACT_OVER.toString()),                Integer.valueOf(ProjectStatusAuction.PUBLISH_OVER.toString()),                Integer.valueOf(ProjectStatusAuction.AUDIT_CONTRACT.toString()),                Integer.valueOf(ProjectStatusAuction.CONTRACT_AUDIT_NOPASS.toString()),                Integer.valueOf(ProjectStatusAuction.SHOW_CONTRACT.toString()),                Integer.valueOf(ProjectStatusAuction.LOCK_CONTRACT.toString()),                Integer.valueOf(ProjectStatusAuction.PAUSE_HIT.toString()),                Integer.valueOf(ProjectStatusAuction.PAUSE_HIT_AUDIT.toString()),                Integer.valueOf(ProjectStatusAuction.PAUSE_HIT_NOPASS.toString()),                Integer.valueOf(ProjectStatusAuction.HIT_QUESTION_HANDLE.toString()),                Integer.valueOf(ProjectStatusAuction.EVALUATE_HIT.toString()),                Integer.valueOf(ProjectStatusAuction.END.toString()),                Integer.valueOf(ProjectStatusAuction.FLOW.toString())));        return list.contains(status);    }    /**     * @description 获取投标人能查看项目投标信息项目状态集合     * @author shy     * @date 2016年9月18日     */    private boolean getBidderProjectStatusList(Integer projectStatus) {        List<Integer> list = new ArrayList<Integer>();        list.addAll(Arrays.asList(                Integer.valueOf(ProjectStatusAuction.AUCTIONING.toString()),                Integer.valueOf(ProjectStatusAuction.OWNER_CONFIRM.toString()),                Integer.valueOf(ProjectStatusAuction.CENTER_CONFIRM.toString()),                Integer.valueOf(ProjectStatusAuction.FLOW_SHOW.toString()),                Integer.valueOf(ProjectStatusAuction.HIT_SHOW.toString()),                Integer.valueOf(ProjectStatusAuction.SHOW_CONTRACT_OVER.toString()),                Integer.valueOf(ProjectStatusAuction.PUBLISH_OVER.toString()),                Integer.valueOf(ProjectStatusAuction.AUDIT_CONTRACT.toString()),                Integer.valueOf(ProjectStatusAuction.CONTRACT_AUDIT_NOPASS.toString()),                Integer.valueOf(ProjectStatusAuction.SHOW_CONTRACT.toString()),                Integer.valueOf(ProjectStatusAuction.LOCK_CONTRACT.toString()),                Integer.valueOf(ProjectStatusAuction.PAUSE_HIT.toString()),                Integer.valueOf(ProjectStatusAuction.PAUSE_HIT_AUDIT.toString()),                Integer.valueOf(ProjectStatusAuction.PAUSE_HIT_NOPASS.toString()),                Integer.valueOf(ProjectStatusAuction.HIT_QUESTION_HANDLE.toString()),                Integer.valueOf(ProjectStatusAuction.EVALUATE_HIT.toString()),                Integer.valueOf(ProjectStatusAuction.END.toString()),                Integer.valueOf(ProjectStatusAuction.FLOW.toString())));        return list.contains(projectStatus);    }    /**     * @description 获取其他角色能查看项目投标信息项目状态集合     * @author wwang     * @date 2016年9月18日     */    private boolean getOtherProjectStatusList(Integer projectStatus) {        List<Integer> list = new ArrayList<Integer>();        list.addAll(Arrays.asList(                Integer.valueOf(ProjectStatusAuction.AUCTIONING.toString()),                Integer.valueOf(ProjectStatusAuction.OWNER_CONFIRM.toString()),                Integer.valueOf(ProjectStatusAuction.CENTER_CONFIRM.toString()),                Integer.valueOf(ProjectStatusAuction.FLOW_SHOW.toString()),                Integer.valueOf(ProjectStatusAuction.HIT_SHOW.toString()),                Integer.valueOf(ProjectStatusAuction.SHOW_CONTRACT_OVER.toString()),                Integer.valueOf(ProjectStatusAuction.PUBLISH_OVER.toString()),                Integer.valueOf(ProjectStatusAuction.AUDIT_CONTRACT.toString()),                Integer.valueOf(ProjectStatusAuction.CONTRACT_AUDIT_NOPASS.toString()),                Integer.valueOf(ProjectStatusAuction.SHOW_CONTRACT.toString()),                Integer.valueOf(ProjectStatusAuction.LOCK_CONTRACT.toString()),                Integer.valueOf(ProjectStatusAuction.PAUSE_HIT.toString()),                Integer.valueOf(ProjectStatusAuction.PAUSE_HIT_AUDIT.toString()),                Integer.valueOf(ProjectStatusAuction.PAUSE_HIT_NOPASS.toString()),                Integer.valueOf(ProjectStatusAuction.HIT_QUESTION_HANDLE.toString()),                Integer.valueOf(ProjectStatusAuction.EVALUATE_HIT.toString()),                Integer.valueOf(ProjectStatusAuction.END.toString()),                Integer.valueOf(ProjectStatusAuction.FLOW.toString())));        return list.contains(projectStatus);    }    /**     * 产权人查看中标信息状态     *     * @param projectStatus     * @return     */    private boolean getBuyerProjectStatusList(Integer projectStatus) {        List<Integer> list = new ArrayList<Integer>();        list.addAll(Arrays.asList(                Integer.valueOf(ProjectStatusAuction.AUCTIONING.toString()),                Integer.valueOf(ProjectStatusAuction.OWNER_CONFIRM.toString()),                Integer.valueOf(ProjectStatusAuction.CENTER_CONFIRM.toString())));        return list.contains(projectStatus);    }    /**     * @param resList     * @return     * @description 判读是否有合同审核信息     * @author wwang     * @date 2016年9月19日     */    private boolean isShowContractAudit(List<Resources> resList) {        // 判断是否有附件信息        for (Resources res : resList) {            if (UPLOADCONTRACT_RES == res.getFunctionFlog() || BIDWINNERFILE_RES ==res.getFunctionFlog()) {                return true;            }        }        return false;    }    /**     * 采购创建项目校验，30天内中不能存在相同的项目名     *     * @return     */    @RequestMapping("/buyer/validProjName")    @ResponseBody    public Boolean validProjName(AuctionInfo project) {        //30天前        Date validTime = StringUtil.addOneDayDate(new Date(), -30);        String validTimeStr = DateUtils.simpleDateFormat(validTime, "yyyy-MM-dd");        validTime = DateUtils.simpleDateFormat(validTimeStr + " 00:00:00", "yyyy-MM-dd HH:mm:ss");        //当前时间        String nowTimeStr = DateUtils.simpleDateFormat(new Date(), "yyyy-MM-dd");        Date nowTime = DateUtils.simpleDateFormat(nowTimeStr + " 23:59:59", "yyyy-MM-dd HH:mm:ss");        List<AuctionInfo> projectList = this.auctionService.findListByWhere(project, validTime, nowTime);        if (projectList != null && projectList.size() >= 1) {            return false;        }        return true;    }	/**	 * @param startDate	 * @param endTime	 * @return	 * @throws Exception	 */	@RequestMapping("/isOkWorkDay")	@ResponseBody	public boolean isOkWorkDay(Date startDate, Date endTime) throws Exception {		DataSet dataset = holidaySetService.get(DataSet.class, Constant.DATASET_ID);		boolean flag = true;		SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");		SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy");		Calendar calStart = Calendar.getInstance();		calStart.setTime(endTime);		List<String> dates = this.holidaySetService.findAllByYear(calStart.get(Calendar.YEAR)+"");		if (dates.contains(sdf1.format(calStart.getTime()))) {			flag = false;		} else {			//采购确认时间			Calendar cd = Calendar.getInstance();			cd.setTime(startDate);			String validTimeStr=sdf1.format(cd.getTime())+" 00:00:00";			//开标时间			Calendar cdBid = Calendar.getInstance();			cdBid.setTime(sdf1.parse(validTimeStr));			//相隔天数			long betweenDay = (calStart.getTime().getTime()-cdBid.getTime().getTime())/(1000*3600*24);			int index=0;			while(betweenDay+1>0){				if (!dates.contains(sdf1.format(calStart.getTime()))) {					index++;				}				calStart.add(Calendar.DAY_OF_YEAR, -1);				betweenDay--;			}			if(index<= dataset.getChangePublicity()){//dataset 设置				flag=false;			}		}		return flag;	}    /**     * @param resId     * @return     * @description 删除文件资源信息     * @author wwang     * @date 2016-8-30     */    @RequestMapping("/deleteFile")    @ResponseBody    public String deleteFile(String resId) {        // 项目关联清单附件信息(撤销理原因附件)        Resources res = null;        res = FileResUtil.getResources(resId);        if (res != null) {            this.auctionService.remove(res);// 更新        }        return Constant.SUCCESS;    }     /**     * @param resId     * @param response     * @param request     * @description 下载查看文件     * @author wei     * @date 2016-8-16     */    @RequestMapping("/fileView")    public ModelAndView fileView(String resId, HttpServletResponse response, HttpServletRequest request) {        Resources resource = this.auctionService.get(Resources.class, resId);        ModelAndView model = new ModelAndView("word_plugin/fileShow");        model.addObject("resId", resId);        return model;    }    /**     * @description 是否超过限额     * @author wei     * @date 2016-8-16     */    @RequestMapping("/isMaxPrice")    @ResponseBody    public boolean isMaxPrice(String catagoryId,Double maxprice) {        boolean moreMax = false;        Double rentMax = dataSetService.getDataSet().getMaxPriceRent();        Double transferMax = dataSetService.getDataSet().getMaxPriceTransfer();        if (catagoryId.equals("540d5cef8b0004f000000056a29c3a03")) {            if (maxprice < rentMax) {                moreMax = true;            }        }        if (catagoryId.equals("540d5cef8b0004f000000056a29c3a02")) {            if (maxprice < transferMax) {                moreMax = true;            }        }        return moreMax;    }    @RequestMapping("/registerBank")    @ResponseBody    public  String registerBank(String id){    	 //推送信息至银行（投标保证金）		AuctionInfo info = this.auctionService.get(AuctionInfo.class,id);		boolean result = postBank(info);		if (!result) {//投标保证金推送失败			return "postbankfaill";		}         return null;	 }}